//
//  MineSettingViewController.m
//  TEst
//
//  Created by   丛熠超 on 2017/4/12.
//  Copyright © 2017年 Tongcheng. All rights reserved.
//

#import "MineSettingViewController.h"
#import "MineChangeMiMaViewController.h"
#import "MineSuggestViewController.h"
#import "MineActivityViewController.h"
#import "MIneAboutViewController.h"
#import "UIImageView+WebCache.h"

@interface MineSettingViewController ()
@property (weak, nonatomic) IBOutlet UISwitch *News;
@property (weak, nonatomic) IBOutlet UISwitch *Move;
@property (weak, nonatomic) IBOutlet UISwitch *VoiceSwi;
@property (weak, nonatomic) IBOutlet UIView *BackView;
@property (weak, nonatomic) IBOutlet UILabel *currentLabel;

@property (weak, nonatomic) IBOutlet UILabel *BackLB;
@property (weak, nonatomic) IBOutlet UIButton *ChangeMi;
@property (weak, nonatomic) IBOutlet UIButton *SuggestBtn;
@property (weak, nonatomic) IBOutlet UIButton *ActivityBtn;
@property (weak, nonatomic) IBOutlet UIButton *AboutBtn;
@property (weak, nonatomic) IBOutlet UIView *HuanCunView;
@property (weak, nonatomic) IBOutlet UILabel *HunCunLB;
@end

@implementation MineSettingViewController

- (void)setupView
{
    self.currentLabel.text = [NSString stringWithFormat:@"当前账号：%@", self.config.userName];
    _ChangeMi.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    _SuggestBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    _ActivityBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    _AboutBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    UITapGestureRecognizer *yanzhengTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yanzhengClick)];
    [_BackView addGestureRecognizer:yanzhengTap];
    
    UITapGestureRecognizer *clear = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clearold)];
    [_HuanCunView addGestureRecognizer:clear];

    float tmpSize = [[SDImageCache sharedImageCache] getDiskCount];
    self.HunCunLB.text = [NSString stringWithFormat:@"%.2f",tmpSize/1000/1000];
    
    NSLog(@"%f",tmpSize);

}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"设置";
    [self setupView];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)GoMiMa:(UIButton *)sender {
    MineChangeMiMaViewController *mima = [[MineChangeMiMaViewController alloc] init];
    [self.navigationController pushViewController:mima animated:YES];
}
- (IBAction)GOSuggest:(UIButton *)sender {
    MineSuggestViewController *suggest = [[MineSuggestViewController alloc] init];
    [self.navigationController pushViewController:suggest animated:YES];
    
}
- (IBAction)GoActivity:(UIButton *)sender {
    MineActivityViewController *activity = [[MineActivityViewController alloc] init];
    [self.navigationController pushViewController:activity animated:NO];
    
}
- (IBAction)GoAbout:(UIButton *)sender {
    MIneAboutViewController *about = [[MIneAboutViewController alloc] init];
    [self.navigationController pushViewController:about animated:NO];
}
- (IBAction)GetNews:(UISwitch *)sender {
    
}
- (IBAction)GetMove:(UISwitch *)sender {
    
}
- (IBAction)GetVoice:(UISwitch *)sender {
    
}

- (void)yanzhengClick {
    NSURL * url = [NSURL URLWithString:@"prefs:root=NOTIFICATIONS_ID"];
    
    if([[UIApplication sharedApplication] canOpenURL:url]) {
        
    [[UIApplication sharedApplication] openURL:url];
        
    }
}

- (void)clearold {
    NSLog(@"clear");
    [[SDImageCache sharedImageCache] clearDisk];
    self.HunCunLB.text = @"0";
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
